From: sos22@douglas.cl.cam.ac.uk Date: Mon, 30 Jan 2006 11:53:33 +0000 (+0100) Subject: Re-arrange things in the domain builder a bit so as to make sure that X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~16511 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/%22bookmarks://%22Dat/%22http:/www.example.com/cgi/%22https:/%22bookmarks:/%22Dat?a=commitdiff_plain;h=397573a0c6716e3290344936588597df083cc3c4;p=xen.git Re-arrange things in the domain builder a bit so as to make sure that when we make a page below 4G in the domain, that gets reflected into the M2P and P2M tables. Signed-off-by: Steven Smith, sos22@cam.ac.uk --- diff --git a/tools/libxc/xc_linux_build.c b/tools/libxc/xc_linux_build.c index 0744acb64a..eae62d20ce 100644 --- a/tools/libxc/xc_linux_build.c +++ b/tools/libxc/xc_linux_build.c @@ -654,6 +654,60 @@ static int setup_guest(int xc_handle, } } + /* setup page tables */ +#if defined(__i386__) + if (dsi.pae_kernel) + rc = setup_pg_tables_pae(xc_handle, dom, ctxt, + dsi.v_start, v_end, + page_array, vpt_start, vpt_end, + shadow_mode_enabled); + else + rc = setup_pg_tables(xc_handle, dom, ctxt, + dsi.v_start, v_end, + page_array, vpt_start, vpt_end, + shadow_mode_enabled); +#endif +#if defined(__x86_64__) + rc = setup_pg_tables_64(xc_handle, dom, ctxt, + dsi.v_start, v_end, + page_array, vpt_start, vpt_end, + shadow_mode_enabled); +#endif + if (0 != rc) + goto error_out; + +#if defined(__i386__) + /* + * Pin down l2tab addr as page dir page - causes hypervisor to provide + * correct protection for the page + */ + if ( !shadow_mode_enabled ) + { + if ( dsi.pae_kernel ) + { + if ( pin_table(xc_handle, MMUEXT_PIN_L3_TABLE, + ctxt->ctrlreg[3] >> PAGE_SHIFT, dom) ) + goto error_out; + } + else + { + if ( pin_table(xc_handle, MMUEXT_PIN_L2_TABLE, + ctxt->ctrlreg[3] >> PAGE_SHIFT, dom) ) + goto error_out; + } + } +#endif + +#if defined(__x86_64__) + /* + * Pin down l4tab addr as page dir page - causes hypervisor to provide + * correct protection for the page + */ + if ( pin_table(xc_handle, MMUEXT_PIN_L4_TABLE, + ctxt->ctrlreg[3] >> PAGE_SHIFT, dom) ) + goto error_out; +#endif + if ( (mmu = xc_init_mmu_updates(xc_handle, dom)) == NULL ) goto error_out; @@ -720,60 +774,6 @@ static int setup_guest(int xc_handle, guest_shared_info_mfn = shared_info_frame; } - /* setup page tables */ -#if defined(__i386__) - if (dsi.pae_kernel) - rc = setup_pg_tables_pae(xc_handle, dom, ctxt, - dsi.v_start, v_end, - page_array, vpt_start, vpt_end, - shadow_mode_enabled); - else - rc = setup_pg_tables(xc_handle, dom, ctxt, - dsi.v_start, v_end, - page_array, vpt_start, vpt_end, - shadow_mode_enabled); -#endif -#if defined(__x86_64__) - rc = setup_pg_tables_64(xc_handle, dom, ctxt, - dsi.v_start, v_end, - page_array, vpt_start, vpt_end, - shadow_mode_enabled); -#endif - if (0 != rc) - goto error_out; - -#if defined(__i386__) - /* - * Pin down l2tab addr as page dir page - causes hypervisor to provide - * correct protection for the page - */ - if ( !shadow_mode_enabled ) - { - if ( dsi.pae_kernel ) - { - if ( pin_table(xc_handle, MMUEXT_PIN_L3_TABLE, - ctxt->ctrlreg[3] >> PAGE_SHIFT, dom) ) - goto error_out; - } - else - { - if ( pin_table(xc_handle, MMUEXT_PIN_L2_TABLE, - ctxt->ctrlreg[3] >> PAGE_SHIFT, dom) ) - goto error_out; - } - } -#endif - -#if defined(__x86_64__) - /* - * Pin down l4tab addr as page dir page - causes hypervisor to provide - * correct protection for the page - */ - if ( pin_table(xc_handle, MMUEXT_PIN_L4_TABLE, - ctxt->ctrlreg[3] >> PAGE_SHIFT, dom) ) - goto error_out; -#endif - *store_mfn = page_array[(vstoreinfo_start-dsi.v_start) >> PAGE_SHIFT]; *console_mfn = page_array[(vconsole_start-dsi.v_start) >> PAGE_SHIFT]; if ( xc_clear_domain_page(xc_handle, dom, *store_mfn) ||